define(function (require) {
    var $ = require("zepto");
    require("music");
    require("weixin");
    var lotter = require("lottery");
    var global = require("global");
    var page = require("page");
    var media = require("media");
    var video = require("video");
    var plugins = {
        init: function () {
            $("#coffee_flow").coffee({
                steams: [
                    "<img src='./img/audio_widget_01@2x.png' />",
                    "<img src='./img/audio_widget_01@2x.png' />"
                ],
                steamHeight: 100,
                steamWidth: 44
            });
            media.media_init();
            video.video_init();
            var t = {};
            "" !== $("#r-wx-title").val() && (t.title = $("#r-wx-title").val());
            "" !== $("#r-wx-img").val() && (t.img = $("#r-wx-img").val());
            "" !== $("#r-wx-con").val() && (t.con = $("#r-wx-con").val());
            "" !== $("#r-wx-link").val() && (t.link = $("#r-wx-link").val());
            "" !== $("#r-wx-callback").val() && (t.callback = $("#r-wx-callback").val());
            global._weixin && $(document.body).wx(t);
            var n = $(".translate-front").data("open");
            if (1 == n) {
                var a = $("#j-mengban")[0], l = "./dist/img/page_01_bg@2x.jpg", c = $("#r-cover").val(), u = "image", d = 640, h = $(window).height(), f = plugins.start_callback;
                plugins.cover_draw(a, l, c, u, d, h, f);
            } else
                plugins.start_callback();
        },
        cover_draw: function (t, e, i, a, o, r, s) {
            if (!(t.style.display.indexOf("none") > -1)) {
                var l = new lotter(t, i, a, o, r, s);
                l.init()
            }
        },
        start_callback: function () {
            var t = $(".translate-front").data("open");
            if (page.page_start(), $(document).one("touchstart", function () {
                media._audio.play()
            }), 1 == t) {
                if ($("#j-mengban").removeClass("z-show"), setTimeout(function () {
                    $("#j-mengban").addClass("f-hide")
                }, 1500), $(".u-arrow").removeClass("f-hide"), !media._audio)
                    return;
                media._audioNode.removeClass("f-hide"), media._audio.play()
            } else
                $("#j-mengban").removeClass("z-show").addClass("f-hide")
        }
    };
    $(window).on("load", function () {
        plugins.init();
    });
});